<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arg1 = 123;
        var isNaN1 = isNaN(arg1);
        console.log(arg1 + (isNaN1 ? ' is not ' : ' is ') + 'a number.');

        var arg2 = ' 123    '; // 包含前后空格，也被识别为数字。
        var isNaN2 = isNaN(arg2);
        console.log(arg2 + (isNaN2 ? ' is not ' : ' is ') + 'a number.');

        var arg3 = 'abc';
        var isNaN3 = isNaN(arg3);
        console.log(arg3 + (isNaN3 ? ' is not ' : ' is ') + 'a number.');

        var arg4 = 0123;
        var isNaN4 = isNaN(arg4);
        console.log(arg4 + (isNaN4 ? ' is not ' : ' is ') + 'a number.');

        var arg5 = 0x123;
        var isNaN5 = isNaN(arg5);
        console.log(arg5 + (isNaN5 ? ' is not ' : ' is ') + 'a number.');

        var arg6 = ' 0x123  '; // 包含前后空格，也被识别为数字。
        var isNaN6 = isNaN(arg6);
        console.log(arg6 + (isNaN6 ? ' is not ' : ' is ') + 'a number.');
    </script>
</body>

</html>

<!-- JavaScript 标准内置对象 -->
<!-- https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects -->

<!-- isNaN() -->
<!-- https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/isNaN -->